<?php
declare (strict_types = 1);

namespace app\common\model;

use think\Model;
use think\model\concern\SoftDelete;
/**
 * @mixin \think\Model
 */
class Goods extends Model
{
    use SoftDelete;
    //与品牌是一对yi的关系
    public function brands()
    {
        return $this->hasOne(Brand::class,'id','brand_id');
    }
   //商品与分类
    public function cate()
    {
        return $this->hasOne(Category::class,'id','cate_id');
    }
    //商品及商品相册的关联关系  一对多
    public function images(){
        return $this->hasMany(GoodsImages::class,'goods_id','id');
    }
    //商品与sku
    public function specGoods(){
        return $this->hasMany(SpecGoods::class,'goods_id','id');
    }
    //商品与种类
    public function types(){
        return $this->hasOne(Type::class,'id','type_id');
    }



}
